package cn.ransj.animation.util;

import java.util.Random;

import android.view.animation.Animation;
import android.view.animation.RotateAnimation;

/**
 * rotate animation utils
 * 
 * @author android
 * 
 */
class Rotateutil implements AnimInterface {
	private static final String TAG = Rotateutil.class.getSimpleName();
	private static final float ACTIONS[][] = { { 0, 720 }, { 0, -720 },
			{ 180, 900 }, { -180, 720 }, };
	private Random mRandom;
	private int mActionLength;

	public void init() {
		mRandom = new Random();
		mActionLength = ACTIONS.length;
	}

	public Animation random() {
		int index = mRandom.nextInt(mActionLength);
		return new RotateAnimation(ACTIONS[index][0], ACTIONS[index][1],
				Animation.RELATIVE_TO_SELF, (float) 0.5,
				Animation.RELATIVE_TO_SELF, (float) 0.5);
	}

}
